import { AppLayoutIndex } from "@/routers/constants";
import { RouteObject } from "../../types/router";
import React from "react";
import lazyLoad from "@/routers/components/LazyLoad";
import { Navigate } from "react-router-dom";
// 首页模块
const SystemRouter: Array<RouteObject> = [
	{
		path: "/app/system",
		element: <AppLayoutIndex />,
		meta: {
			appCode: "system"
		},
		children: [
			{
				// 默认重定向到第一个子路由
				path: "/app/system/home",
				component: () => import("@/pages/app/system/home"),
				meta: {
					requiresAuth: false,
					title: "看板",
					isPageLayout: false,
					key: "home",
					isTitle: false
				}
			},

			{
				path: "/app/system/log/loginLog",
				component: () => import("@/pages/app/system/log/loginLog"),
				meta: {
					requiresAuth: false,
					title: "登录日志",
					key: "loginLog"
				}
			},
			{
				path: "/app/system/log/operLog",
				component: () => import("@/pages/app/system/log/operLog"),
				meta: {
					requiresAuth: false,
					title: "行为日志",
					key: "operLog"
				}
			},
			{
				path: "/app/system/log/online",
				component: () => import("@/pages/app/system/log/online"),
				meta: {
					requiresAuth: false,
					title: "在线用户",
					key: "online"
				}
			},
			{
				path: "/app/system/authority/role",
				component: () => import("@/pages/app/system/authority/role"),
				meta: {
					requiresAuth: false,
					title: "角色管理",
					isTitle: true,
					key: "role"
				}
			},
			{
				path: "/app/system/authority/application",
				component: () => import("@/pages/app/system/authority/application"),
				meta: {
					requiresAuth: false,
					title: "应用管理",
					isTitle: true,
					key: "application"
				}
			},
			{
				path: "/app/system/authority/menu",
				component: () => import("@/pages/app/system/authority/menu"),
				meta: {
					requiresAuth: false,
					title: "菜单管理",
					isTitle: true,
					key: "menu"
				}
			},
			{
				path: "/app/system/storage/config",
				component: () => import("@/pages/app/system/storage/config"),
				meta: {
					requiresAuth: false,
					title: "存储桶配置",
					isTitle: true,
					key: "storageConfig"
				}
			},
			{
				path: "/app/system/storage/file",
				component: () => import("@/pages/app/system/storage/file"),
				meta: {
					requiresAuth: false,
					title: "文件列表",
					isTitle: false,
					key: "storageFile"
				}
			},
			{
				path: "/app/system/meta/dict",
				component: () => import("@/pages/app/system/meta/dict"),
				meta: {
					requiresAuth: false,
					title: "字典管理",
					isTitle: false,
					key: "dictManager"
				}
			},
			{
				path: "/app/system/tenant/tenants",
				component: () => import("@/pages/app/system/tenant/tenant"),
				meta: {
					requiresAuth: false,
					title: "租户列表",
					isTitle: true,
					key: "tenantList"
				}
			},
			{
				path: "/app/system/tenant/tenantDetail",
				component: () => import("@/pages/app/system/tenant/tenant/components/TenantDetails"),
				meta: {
					requiresAuth: false,
					title: "租户详情",
					isTitle: false,
					key: "tenantDetail"
				}
			},
			// {
			// 	path: "/app/system/tenant/form",
			// 	element: lazyLoad(React.lazy(() => import("@/pages/app/system/tenant/tenant/components/TenantFormPage"))),
			// 	meta: {
			// 		requiresAuth: false,
			// 		title: "租户页",
			// 		isTitle: false,
			// 		key: "tenantList"
			// 	}
			// },
			{
				path: "/app/system/setting",
				component: () => import("@/pages/app/system/setting"),
				meta: {
					requiresAuth: false,
					title: "系统设置",
					isTitle: false,
					key: "systemSetting"
				}
			},
			// {
			// 	// 默认重定向到第一个子路由
			// 	path: "/app/system",
			// 	element: <Navigate to="/app/message/overview" replace={true} />,
			// 	meta: {
			// 		requiresAuth: false,
			// 		title: "消息中心概览",
			// 		isPageLayout: true,
			// 		key: "message-redirect"
			// 	}
			// },
			// {
			// 	path: "/app/system/overview",
			// 	element: lazyLoad(React.lazy(() => import("@/pages/app/system/overview"))),
			// 	meta: {
			// 		requiresAuth: false,
			// 		title: "消息中心概览",
			// 		isTitle: true,
			// 		key: "messageOverview"
			// 	}
			// },
			{
				path: "/app/system/message/template",
				component: () => import("@/pages/app/system/message/template"),
				meta: {
					requiresAuth: false,
					title: "消息模板",
					isTitle: true,
					key: "messageTemplate"
				}
			},
			{
				path: "/app/system/message/template/form",
				component: () => import("@/pages/app/system/message/template/components/TemplateFormPage"),
				meta: {
					requiresAuth: false,
					title: "消息模板页",
					isTitle: false,
					key: "messageFormTemplate"
				}
			},
			{
				path: "/app/system/message/config",
				component: () => import("@/pages/app/system/message/config"),
				meta: {
					requiresAuth: false,
					title: "消息配置",
					isTitle: true,
					key: "messageConfig"
				}
			},
			{
				path: "/app/system/notice/notifyList",
				component: () => import("@/pages/app/system/notice/notifyList"),
				meta: {
					requiresAuth: false,
					title: "公告列表",
					isTitle: true,
					key: "messageNotice"
				}
			},
			{
				// 添加重定向配置
				path: "/app/system",
				redirect: "/app/system/home"
			}
		]
	}
];

export default SystemRouter;
